package com.example.test.test;


import java.util.List;

import com.example.test.demin.Bill;
import com.example.test.demin.Card;
import com.example.test.demin.TingcheChang;
import com.example.test.demin.User;
import com.example.test.utils.DbDaoUtils;
import com.example.test.utils.DbHelper;


import android.test.AndroidTestCase;

public class DBtest extends AndroidTestCase {

	public void testCreateDb() throws Exception {
		DbHelper helper = new DbHelper(
				getContext(), "tingche", null, 1);
		helper.getWritableDatabase();
	}
	public void testInsert() throws Exception{
		DbDaoUtils daoUtils=new DbDaoUtils(getContext());
	long res=daoUtils.insertUser("xth", "123", "15823648946", 5454545);
	System.out.println(res);
	}
	public void testInsertbill() throws Exception{
		DbDaoUtils daoUtils=new DbDaoUtils(getContext());
	long res=daoUtils.insertBill("Test", "Test", 300);
	System.out.println(res);
	}
	public void testInsertCARD() throws Exception{
		DbDaoUtils daoUtils=new DbDaoUtils(getContext());
	long res=daoUtils.insertCard("��������", "622023100068486156", 500);
	System.out.println(res);
	}
	public void testfind() throws Exception {

		DbDaoUtils dao=new DbDaoUtils(getContext());
		boolean result=dao.findUser("xh5", "123");
		assertEquals(true, result);
		
	}
	public void testfindCard() throws Exception {

		DbDaoUtils dao=new DbDaoUtils(getContext());
		Card result=dao.findCardInfo("622023100068486156");
		System.out.println(result.toString());
		
	}
	public void testfindBill() throws Exception {

		DbDaoUtils dao=new DbDaoUtils(getContext());
		int id=1;
		Bill result=dao.findBillInfo(id);
		System.out.println(result.toString());
		
	}
	public void testquey() throws Exception{
		DbDaoUtils daoUtils=new DbDaoUtils(getContext());
		User user = daoUtils.findUserInfo("xh");
		System.out.println(user.toString());
	}
	public void testfindcar() throws Exception{
		DbDaoUtils daoUtils=new DbDaoUtils(getContext());
		TingcheChang user = daoUtils.findTingcheInfobyTnumber("6903244670036");
		System.out.println(user.toString());
	}
	
	public void testfindall() throws Exception{
		DbDaoUtils daoUtils=new DbDaoUtils(getContext());
		List<User> list=daoUtils.findAll();
		for(User user:list){
			System.out.println(user.toString());
		}
	}

	public void testfindallbill() throws Exception{
		DbDaoUtils daoUtils=new DbDaoUtils(getContext());
		List<Bill> list=daoUtils.findALLBillInfo();
		for(Bill user:list){
			System.out.println(user.toString());
		}
	}
	public void testfindaLLCard() throws Exception{
		DbDaoUtils daoUtils=new DbDaoUtils(getContext());
		List<Card> list=daoUtils.findAllCard();
		for(Card user:list){
			System.out.println(user.toString());
		}
	}

}
